﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BattleCore.Events;
using PsyModules;

namespace Battle
{
    public class PrizeControl
    {
        private Prizes[] toynums = new Prizes[] 
        { Prizes.Repel, Prizes.Burst, Prizes.Decoy,
            Prizes.Thor, Prizes.Brick, Prizes.Rocket, Prizes.Portal };

        /// <summary>
        /// This will gift a saved toys state to a player.
        /// </summary>
        /// <param name="PlayerName">Player to gift.</param>
        /// <param name="State">Saved toy state.</param>
        /// <param name="q">Queue that you want to add messages to.</param>
        /// <returns></returns>
        public Queue<EventArgs> LoadPrizeState(string PlayerName, PrizeState State, Queue<EventArgs> q)
        {
            // custom chat module
            ShortChat msg = new ShortChat();

            // itirate through item list
            for (int i = 0; i < State.PrizeList.Length; i++)
            {
                // get the
                int toys = State.PrizeList[i];
                while (toys != 0)
                {
                    q.Enqueue(msg.pm(PlayerName, "*prize #" + (int)toynums[i]));
                    toys--;
                }
            }

            return q;
        }
    }
}
